"""Given an array and a value, remove all instances of that value in place and return
 the new length.The order of elements can be changed. It doesn't matter what you leave 
 beyond the new length."""
 #author:timlentse(tinglenxan@gmail.com)
 #Date: 2014-11-15

class Solution:
    # @param    A       a list of integers
    # @param    elem    an integer, value need to be removed
    # @return an integer
    def removeElement(self, A, elem):
        while A.count(elem) > 0:
            A.remove(elem)
        return len(A)
test = Solution()
a=[1,2,3,4,4,4,5,6,7,8,9,1,1]
print test.removeElement(a,1)
        